
import java.util.Locale;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

@SuppressWarnings("deprecation")
public class HibernateUtil {
	
	private static  SessionFactory sessionFactory;

	static {
		// This line is needed for right working
		Locale.setDefault(Locale.ENGLISH);
		try {

			sessionFactory=new Configuration()
			.addAnnotatedClass(Student.class)
			.addAnnotatedClass(University.class)
			.addAnnotatedClass(Faculty.class)
			.addAnnotatedClass(Professor.class)
			.addAnnotatedClass(User.class)
			.addAnnotatedClass(Subject.class)
			.addAnnotatedClass(Exam.class)
			.addAnnotatedClass(ExamWithResult.class)
			.addAnnotatedClass(Material.class)
			.configure().buildSessionFactory();
			
		} catch (Throwable e) {
			e.printStackTrace();
		}
	}

	public static SessionFactory getSessionFactory() {
		return sessionFactory;
	}
}
